\(\int \csc ^3(c+d x) (a+b \tan (c+d x)) \, dx\) [18]

   Optimal result
   Rubi [A] (verified)
   Mathematica [C] (verified)
   Maple [A] (verified)
   Fricas [B] (verification not implemented)
   Sympy [F]
   Maxima [A] (verification not implemented)
   Giac [B] (verification not implemented)
   Mupad [B] (verification not implemented)

Optimal result

Integrand size = 19, antiderivative size = 60 \[ \int \csc ^3(c+d x) (a+b \tan (c+d x)) \, dx=-\frac {a \text {arctanh}(\cos (c+d x))}{2 d}+\frac {b \text {arctanh}(\sin (c+d x))}{d}-\frac {b \csc (c+d x)}{d}-\frac {a \cot (c+d x) \csc (c+d x)}{2 d} \]

[Out]

-1/2*a*arctanh(cos(d*x+c))/d+b*arctanh(sin(d*x+c))/d-b*csc(d*x+c)/d-1/2*a*cot(d*x+c)*csc(d*x+c)/d

Rubi [A] (verified)

Time = 0.08 (sec) , antiderivative size = 60, normalized size of antiderivative = 1.00, number of steps used = 7, number of rules used = 6, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.316, Rules used = {3598, 3853, 3855, 2701, 327, 213} \[ \int \csc ^3(c+d x) (a+b \tan (c+d x)) \, dx=-\frac {a \text {arctanh}(\cos (c+d x))}{2 d}-\frac {a \cot (c+d x) \csc (c+d x)}{2 d}+\frac {b \text {arctanh}(\sin (c+d x))}{d}-\frac {b \csc (c+d x)}{d} \]

[In]

Int[Csc[c + d*x]^3*(a + b*Tan[c + d*x]),x]

[Out]

-1/2*(a*ArcTanh[Cos[c + d*x]])/d + (b*ArcTanh[Sin[c + d*x]])/d - (b*Csc[c + d*x])/d - (a*Cot[c + d*x]*Csc[c +
d*x])/(2*d)

Rule 213

Int[((a_) + (b_.)*(x_)^2)^(-1), x_Symbol] :> Simp[(-(Rt[-a, 2]*Rt[b, 2])^(-1))*ArcTanh[Rt[b, 2]*(x/Rt[-a, 2])]
, x] /; FreeQ[{a, b}, x] && NegQ[a/b] && (LtQ[a, 0] || GtQ[b, 0])

Rule 327

Int[((c_.)*(x_))^(m_)*((a_) + (b_.)*(x_)^(n_))^(p_), x_Symbol] :> Simp[c^(n - 1)*(c*x)^(m - n + 1)*((a + b*x^n
)^(p + 1)/(b*(m + n*p + 1))), x] - Dist[a*c^n*((m - n + 1)/(b*(m + n*p + 1))), Int[(c*x)^(m - n)*(a + b*x^n)^p
, x], x] /; FreeQ[{a, b, c, p}, x] && IGtQ[n, 0] && GtQ[m, n - 1] && NeQ[m + n*p + 1, 0] && IntBinomialQ[a, b,
 c, n, m, p, x]

Rule 2701

Int[(csc[(e_.) + (f_.)*(x_)]*(a_.))^(m_)*sec[(e_.) + (f_.)*(x_)]^(n_.), x_Symbol] :> Dist[-(f*a^n)^(-1), Subst
[Int[x^(m + n - 1)/(-1 + x^2/a^2)^((n + 1)/2), x], x, a*Csc[e + f*x]], x] /; FreeQ[{a, e, f, m}, x] && Integer
Q[(n + 1)/2] &&  !(IntegerQ[(m + 1)/2] && LtQ[0, m, n])

Rule 3598

Int[sin[(e_.) + (f_.)*(x_)]^(m_.)*((a_) + (b_.)*tan[(e_.) + (f_.)*(x_)])^(n_.), x_Symbol] :> Int[Expand[Sin[e
+ f*x]^m*(a + b*Tan[e + f*x])^n, x], x] /; FreeQ[{a, b, e, f}, x] && IntegerQ[(m - 1)/2] && IGtQ[n, 0]

Rule 3853

Int[(csc[(c_.) + (d_.)*(x_)]*(b_.))^(n_), x_Symbol] :> Simp[(-b)*Cos[c + d*x]*((b*Csc[c + d*x])^(n - 1)/(d*(n
- 1))), x] + Dist[b^2*((n - 2)/(n - 1)), Int[(b*Csc[c + d*x])^(n - 2), x], x] /; FreeQ[{b, c, d}, x] && GtQ[n,
 1] && IntegerQ[2*n]

Rule 3855

Int[csc[(c_.) + (d_.)*(x_)], x_Symbol] :> Simp[-ArcTanh[Cos[c + d*x]]/d, x] /; FreeQ[{c, d}, x]

Rubi steps \begin{align*} \text {integral}& = \int \left (a \csc ^3(c+d x)+b \csc ^2(c+d x) \sec (c+d x)\right ) \, dx \\ & = a \int \csc ^3(c+d x) \, dx+b \int \csc ^2(c+d x) \sec (c+d x) \, dx \\ & = -\frac {a \cot (c+d x) \csc (c+d x)}{2 d}+\frac {1}{2} a \int \csc (c+d x) \, dx-\frac {b \text {Subst}\left (\int \frac {x^2}{-1+x^2} \, dx,x,\csc (c+d x)\right )}{d} \\ & = -\frac {a \text {arctanh}(\cos (c+d x))}{2 d}-\frac {b \csc (c+d x)}{d}-\frac {a \cot (c+d x) \csc (c+d x)}{2 d}-\frac {b \text {Subst}\left (\int \frac {1}{-1+x^2} \, dx,x,\csc (c+d x)\right )}{d} \\ & = -\frac {a \text {arctanh}(\cos (c+d x))}{2 d}+\frac {b \text {arctanh}(\sin (c+d x))}{d}-\frac {b \csc (c+d x)}{d}-\frac {a \cot (c+d x) \csc (c+d x)}{2 d} \\ \end{align*}

Mathematica [C] (verified)

Result contains higher order function than in optimal. Order 5 vs. order 3 in optimal.

Time = 0.03 (sec) , antiderivative size = 107, normalized size of antiderivative = 1.78 \[ \int \csc ^3(c+d x) (a+b \tan (c+d x)) \, dx=-\frac {a \csc ^2\left (\frac {1}{2} (c+d x)\right )}{8 d}-\frac {b \csc (c+d x) \operatorname {Hypergeometric2F1}\left (-\frac {1}{2},1,\frac {1}{2},\sin ^2(c+d x)\right )}{d}-\frac {a \log \left (\cos \left (\frac {1}{2} (c+d x)\right )\right )}{2 d}+\frac {a \log \left (\sin \left (\frac {1}{2} (c+d x)\right )\right )}{2 d}+\frac {a \sec ^2\left (\frac {1}{2} (c+d x)\right )}{8 d} \]

[In]

Integrate[Csc[c + d*x]^3*(a + b*Tan[c + d*x]),x]

[Out]

-1/8*(a*Csc[(c + d*x)/2]^2)/d - (b*Csc[c + d*x]*Hypergeometric2F1[-1/2, 1, 1/2, Sin[c + d*x]^2])/d - (a*Log[Co
s[(c + d*x)/2]])/(2*d) + (a*Log[Sin[(c + d*x)/2]])/(2*d) + (a*Sec[(c + d*x)/2]^2)/(8*d)

Maple [A] (verified)

Time = 1.35 (sec) , antiderivative size = 68, normalized size of antiderivative = 1.13

method result size
derivativedivides \(\frac {b \left (-\frac {1}{\sin \left (d x +c \right )}+\ln \left (\sec \left (d x +c \right )+\tan \left (d x +c \right )\right )\right )+a \left (-\frac {\csc \left (d x +c \right ) \cot \left (d x +c \right )}{2}+\frac {\ln \left (\csc \left (d x +c \right )-\cot \left (d x +c \right )\right )}{2}\right )}{d}\) \(68\)
default \(\frac {b \left (-\frac {1}{\sin \left (d x +c \right )}+\ln \left (\sec \left (d x +c \right )+\tan \left (d x +c \right )\right )\right )+a \left (-\frac {\csc \left (d x +c \right ) \cot \left (d x +c \right )}{2}+\frac {\ln \left (\csc \left (d x +c \right )-\cot \left (d x +c \right )\right )}{2}\right )}{d}\) \(68\)
risch \(-\frac {i {\mathrm e}^{i \left (d x +c \right )} \left (i a \,{\mathrm e}^{2 i \left (d x +c \right )}+2 b \,{\mathrm e}^{2 i \left (d x +c \right )}+i a -2 b \right )}{d \left ({\mathrm e}^{2 i \left (d x +c \right )}-1\right )^{2}}+\frac {a \ln \left ({\mathrm e}^{i \left (d x +c \right )}-1\right )}{2 d}-\frac {a \ln \left ({\mathrm e}^{i \left (d x +c \right )}+1\right )}{2 d}-\frac {b \ln \left ({\mathrm e}^{i \left (d x +c \right )}-i\right )}{d}+\frac {b \ln \left ({\mathrm e}^{i \left (d x +c \right )}+i\right )}{d}\) \(142\)

[In]

int(csc(d*x+c)^3*(a+b*tan(d*x+c)),x,method=_RETURNVERBOSE)

[Out]

1/d*(b*(-1/sin(d*x+c)+ln(sec(d*x+c)+tan(d*x+c)))+a*(-1/2*csc(d*x+c)*cot(d*x+c)+1/2*ln(csc(d*x+c)-cot(d*x+c))))

Fricas [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 142 vs. \(2 (56) = 112\).

Time = 0.28 (sec) , antiderivative size = 142, normalized size of antiderivative = 2.37 \[ \int \csc ^3(c+d x) (a+b \tan (c+d x)) \, dx=\frac {2 \, a \cos \left (d x + c\right ) - {\left (a \cos \left (d x + c\right )^{2} - a\right )} \log \left (\frac {1}{2} \, \cos \left (d x + c\right ) + \frac {1}{2}\right ) + {\left (a \cos \left (d x + c\right )^{2} - a\right )} \log \left (-\frac {1}{2} \, \cos \left (d x + c\right ) + \frac {1}{2}\right ) + 2 \, {\left (b \cos \left (d x + c\right )^{2} - b\right )} \log \left (\sin \left (d x + c\right ) + 1\right ) - 2 \, {\left (b \cos \left (d x + c\right )^{2} - b\right )} \log \left (-\sin \left (d x + c\right ) + 1\right ) + 4 \, b \sin \left (d x + c\right )}{4 \, {\left (d \cos \left (d x + c\right )^{2} - d\right )}} \]

[In]

integrate(csc(d*x+c)^3*(a+b*tan(d*x+c)),x, algorithm="fricas")

[Out]

1/4*(2*a*cos(d*x + c) - (a*cos(d*x + c)^2 - a)*log(1/2*cos(d*x + c) + 1/2) + (a*cos(d*x + c)^2 - a)*log(-1/2*c
os(d*x + c) + 1/2) + 2*(b*cos(d*x + c)^2 - b)*log(sin(d*x + c) + 1) - 2*(b*cos(d*x + c)^2 - b)*log(-sin(d*x +
c) + 1) + 4*b*sin(d*x + c))/(d*cos(d*x + c)^2 - d)

Sympy [F]

\[ \int \csc ^3(c+d x) (a+b \tan (c+d x)) \, dx=\int \left (a + b \tan {\left (c + d x \right )}\right ) \csc ^{3}{\left (c + d x \right )}\, dx \]

[In]

integrate(csc(d*x+c)**3*(a+b*tan(d*x+c)),x)

[Out]

Integral((a + b*tan(c + d*x))*csc(c + d*x)**3, x)

Maxima [A] (verification not implemented)

none

Time = 0.20 (sec) , antiderivative size = 83, normalized size of antiderivative = 1.38 \[ \int \csc ^3(c+d x) (a+b \tan (c+d x)) \, dx=\frac {a {\left (\frac {2 \, \cos \left (d x + c\right )}{\cos \left (d x + c\right )^{2} - 1} - \log \left (\cos \left (d x + c\right ) + 1\right ) + \log \left (\cos \left (d x + c\right ) - 1\right )\right )} - 2 \, b {\left (\frac {2}{\sin \left (d x + c\right )} - \log \left (\sin \left (d x + c\right ) + 1\right ) + \log \left (\sin \left (d x + c\right ) - 1\right )\right )}}{4 \, d} \]

[In]

integrate(csc(d*x+c)^3*(a+b*tan(d*x+c)),x, algorithm="maxima")

[Out]

1/4*(a*(2*cos(d*x + c)/(cos(d*x + c)^2 - 1) - log(cos(d*x + c) + 1) + log(cos(d*x + c) - 1)) - 2*b*(2/sin(d*x
+ c) - log(sin(d*x + c) + 1) + log(sin(d*x + c) - 1)))/d

Giac [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 118 vs. \(2 (56) = 112\).

Time = 0.37 (sec) , antiderivative size = 118, normalized size of antiderivative = 1.97 \[ \int \csc ^3(c+d x) (a+b \tan (c+d x)) \, dx=\frac {a \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{2} + 8 \, b \log \left ({\left | \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) + 1 \right |}\right ) - 8 \, b \log \left ({\left | \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) - 1 \right |}\right ) + 4 \, a \log \left ({\left | \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) \right |}\right ) - 4 \, b \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) - \frac {6 \, a \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{2} + 4 \, b \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) + a}{\tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{2}}}{8 \, d} \]

[In]

integrate(csc(d*x+c)^3*(a+b*tan(d*x+c)),x, algorithm="giac")

[Out]

1/8*(a*tan(1/2*d*x + 1/2*c)^2 + 8*b*log(abs(tan(1/2*d*x + 1/2*c) + 1)) - 8*b*log(abs(tan(1/2*d*x + 1/2*c) - 1)
) + 4*a*log(abs(tan(1/2*d*x + 1/2*c))) - 4*b*tan(1/2*d*x + 1/2*c) - (6*a*tan(1/2*d*x + 1/2*c)^2 + 4*b*tan(1/2*
d*x + 1/2*c) + a)/tan(1/2*d*x + 1/2*c)^2)/d

Mupad [B] (verification not implemented)

Time = 4.88 (sec) , antiderivative size = 149, normalized size of antiderivative = 2.48 \[ \int \csc ^3(c+d x) (a+b \tan (c+d x)) \, dx=\frac {a\,{\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^2}{8\,d}-\frac {\frac {a}{2}+2\,b\,\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}{4\,d\,{\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^2}-\frac {b\,\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}{2\,d}-\frac {2\,b\,\mathrm {atanh}\left (\frac {4\,b^2}{2\,a\,b-4\,b^2\,\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}-\frac {2\,a\,b\,\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}{2\,a\,b-4\,b^2\,\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}\right )}{d}+\frac {a\,\ln \left (\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )\right )}{2\,d} \]

[In]

int((a + b*tan(c + d*x))/sin(c + d*x)^3,x)

[Out]

(a*tan(c/2 + (d*x)/2)^2)/(8*d) - (a/2 + 2*b*tan(c/2 + (d*x)/2))/(4*d*tan(c/2 + (d*x)/2)^2) - (b*tan(c/2 + (d*x
)/2))/(2*d) - (2*b*atanh((4*b^2)/(2*a*b - 4*b^2*tan(c/2 + (d*x)/2)) - (2*a*b*tan(c/2 + (d*x)/2))/(2*a*b - 4*b^
2*tan(c/2 + (d*x)/2))))/d + (a*log(tan(c/2 + (d*x)/2)))/(2*d)